<!DOCTYPE html>
<html lang="zxx">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<link rel="icon" href="images/favicon.png">
	<title></title>

	<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
	<link rel="stylesheet" href="css/materialize.css">
	<link rel="stylesheet" href="css/loaders.css">
	<link rel="stylesheet" href="css/lightbox.css">
	<link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css">
	<link rel="stylesheet" href="css/owl.carousel.min.css">
	<link rel="stylesheet" href="css/owl.theme.default.min.css">
	<link rel="stylesheet" href="css/style.css">
	    <link rel="stylesheet" href="css/layer.css">

</head>
<style>

</style>
<body>
	
	<!-- navbar -->
	<div class="navbar">
		<div class="container">
			<div class="row">
				<div class="col s9">
					<div class="content-left" onclick="javascript:history.back('index.html');">
					<i class="fa fa-chevron-left center"></i>
										</div>
				</div>
				
			</div>
		</div>
	</div>
	<!-- end navbar -->
	
	<!-- sidebar -->
	
	<!-- end sidebar -->

	<!-- table -->
<div class="segments-page">
		<div class="container" style=" width: 90%;">
			<div class="pages-title">
				<h3>提现</h3>
				<div class="line"></div>
			</div>
			<div class="total-pay">
				<div class="row">
					<div class="col s8">
						<div class="contents">
							<p>可以提现金额</p>
						</div>
					</div>
					<div class="col s4">
						<div class="contents right">
							<p id="withdrawal_amount"></p>
						</div>
					</div>
				
				
				</div>
			</div>
			
			<div class="checkout">
					<form id="form" onsubmit="return false" action="##" method="post">
						      <input type="hidden" name="bank" id="bank_id" value="">
							      <input type="hidden" name="sxf" id="sxf_id" value="">
								      <input type="hidden" name="arrival_amount" id="arrival_amount_id" value="">
					 <input type="text" readonly="readonly"  placeholder="收款账号" id="bank">
					 
					<input type="number"min="1" name="number"id="number" placeholder="提现金额">
					<input type="number"min="1" id="sxf"  placeholder="" placeholder="提现手续费" disabled>
					<input type="number"min="1"  id="arrival_amount" placeholder="到账金额" disabled>
					<input type="password" name="TradersPassword" placeholder="交易密码">
					<button class="button checkout-button " onclick="withdraw();"><i class="fa fa-send"></i>提现</button>
				</form>
			</div>
			
		</div>
	</div>
	<div class="pages-title">
			<h3>提现流水</h3>
			<div class="line"></div>
			<div class="list_box table-contents z-depth-1" style="min-height: 200px;padding: 0px 10px 0;" >
					<table>
						<thead>
							<tr>
									<th>记录</th>
									
									<th>时间</th>
							</tr>
							
						</thead>
						<tbody id="container">
						
						</tbody>
						
					</table>
		</div>
	</div>
	<!-- end table -->
	<script src="js/jquery.min.js"></script>
	<script src="js/materialize.js"></script>
	<script src="js/owl.carousel.min.js"></script>
	<script src="js/main.js"></script>
	<script src="js/jquery.min.js"></script>
	<script src="js/materialize.js"></script>
	<script src="js/numscroller.js"></script>
	<script src="js/lightbox.js"></script>
	<script src="js/owl.carousel.min.js"></script>
	<script src="js/main.js"></script>
	<script src="js/layer.js"></script>
	<script src="js/jquerysession.js"></script>
	<script src="http://www.gongjuji.net/Content/files/jquery.md5.js"></script>
	<script src="js/index.js"></script>
	<script src="js/mobileSelect.js"></script>
<script>

	$(document).ready(function () {
	    var GetActivationurl = 'Member/index';//当前会员信息
	    var GetActivationInfo = api_request(GetActivationurl, 'GET');
		
	    if(GetActivationInfo.code==1){
			var  up_integral=GetActivationInfo.data.data.up_integral; //当前会员充值积分

			
			var up_integralhtml = document.getElementById("withdrawal_amount");//当前会员充值积分
			up_integralhtml.innerHTML += up_integral+'￥';
			
				var url = 'cms/label/name/withdraw_sxf'; //转换类型接口
				var Info = api_request(url, 'GET');
				var Sxfdata=Info.data
				if(Sxfdata !=0){
					  $('#sxf').attr('placeholder', '手续费：'+Sxfdata+'￥')
					$("#number").on('input',function(){
					               if(!($('#number').val()=='')){
					                var   number=$('#number').val();
					              var  money =number - number  * Sxfdata;
							    	$('#arrival_amount').attr('placeholder', '到账金额：'+money)
									   $("#arrival_amount_id").val(money)
									      $("#sxf_id").val(Sxfdata)
					               }
					           })
				}else{
					$("#number").on('input',function(){
						 if(!($('#number').val()=='')){
							 var   number=$('#number').val();
							 $('#arrival_amount').attr('placeholder', '到账金额：'+number)
							    $("#arrival_amount_id").val(number)
							 }
						  })
					  $('#sxf').attr('placeholder', '暂未有手续费')
					
				}
				
				var list = api_request('Bill/Bill?type=7&genre=1', 'GET');
				
				
				if(list.data){
					var html = "";
					for(var i=0;i<list.data.length;i++){
						 var ls=list.data[i];
						html="<tr><td>"+ls.details+"</td><td>"+ls.add_time+"</td></tr> "
						
							  $('#container').append(html);
							  
					}
				
				
				}else{
					html="暂未有记录"
					var container = document.getElementById("container");
					container.innerHTML += html;
				}
			}

	 }); 
	 
	
	
var UserbankList = 'Member/UserbankList';
        var UserbankList = api_request(UserbankList, 'GET');
	var data=UserbankList.data.data
		if(data.length !=0){
			var mobileSelect1 = new MobileSelect({
			    trigger: '#bank',
			    title: '卡号选择',
			    wheels: [
			           {data: data}
			    ],
			    transitionEnd: function (indexArr, data) {
			
			    },
			    callback: function (indexArr, data) {
						  $('#bank').attr('placeholder', data[0].value)
					   $("#bank_id").val(data[0].id)
			    }
			});
			}

	 function withdraw(){
		   var params = $('#form').serializeObject();
		
		   if(!params.bank){
			   layer.open({
			       content: '请选择提现收款账号!'
			       , skin: 'msg'
			       , time: 2 //2秒后自动关闭
			   });
			   return false;
		   }
		   if(!params.number){
		   			   layer.open({
		   			       content: '请输入数量!'
		   			       , skin: 'msg'
		   			       , time: 2 //2秒后自动关闭
		   			   });
		   			   return false;
		   }
		   if(!params.TradersPassword){
		   			   layer.open({
		   			       content: '请输入交易密码!'
		   			       , skin: 'msg'
		   			       , time: 2 //2秒后自动关闭
		   			   });
		   	  return false;
		   }
		
		   layer.open({
		     content:"确定提现吗?"
		     ,btn: ['确定', '取消']
		     ,yes: function(index){
		       var withdrawurl = 'Member/withdraw';
		   		var withdrawInfo = api_request(withdrawurl, 'POST',params);
			
		   					  if(withdrawInfo.code==1){
		   						layer.open({
		   						    content: withdrawInfo.data
		   						    , skin: 'msg'
		   						    , time: 2//2秒后自动关闭
		   						    , end: function () {
		   								   location.reload();
		   						    }
		   						});
		   					  }
		     }
		   });
	
	 }

</script>
</body>
</html>